package co.lq.domain;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.CreationTimestamp;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author billy
 * @date 2018-11-24
 */
@Entity
@Data
@Table(name = "log")
@NoArgsConstructor
public class Log implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long      id;

    /** 操作用户 */
    private String    username;

    /** 描述 */
    private String    description;

    /** 方法名 */
    private String    method;

    private Long      uid;

    private Integer   type;

    /** 参数 */
    @Column(columnDefinition = "text")
    private String    params;

    /** 日志类型 */
    @Column(name = "log_type")
    private String    logType;

    /** 请求ip */
    @Column(name = "request_ip")
    private String    requestIp;

    /** 地址 */
    @Column(name = "address")
    private String    address;

    /** 浏览器 */
    private String    browser;

    /** 请求耗时 */
    private Long      time;

    /** 异常详细 */
    @Column(name = "exception_detail", columnDefinition = "text")
    private byte[]    exceptionDetail;

    /** 创建日期 */
    @CreationTimestamp
    @Column(name = "create_time")
    private Timestamp createTime;

    /** 所属店铺 */
    @Column(name = "store_id")
    private Long      storeId;

    public Log(String logType, Long time) {
        this.logType = logType;
        this.time = time;
    }
}
